<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload=function(){
          var oBtn=document.getElementById('btn1');
          if(oBtn.attachEvent){
              oBtn.attachEvent('onclick',function(){
                  alert('a');
              });
              oBtn.attachEvent('onclick',function(){
                  alert('b');
              });
          }
          else{
              oBtn.addEventListener('click',function(){
                  alert('a');
              },false);
              oBtn.addEventListener('click',function(){
                  alert('b');
              },false);
          }
        };
    </script>
</head>
<body>
<input type="button" value="按钮" id="btn1">
</body>
</html>